//Copyright 2011 New York City 3D Community

//This file is part of New York City 3D.

//New York City 3D is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//New York City 3D is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with New York City 3D.  If not, see <http://www.gnu.org/licenses/>.

package nyc3d.gui;

import nyc3d.NYC3D;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

/**
 *
 * @author Joseph
 */
public class GameExitScreen implements ScreenController{
    /**
   * the nifty instance.
   */
  private Nifty nifty;

  /**
   * the screen this menu belongs to.
   */
  private Screen screen;

  /**
   * bind.
   * @param niftyParam niftyParam
   * @param screenParam screenParam
   */
  public void bind(final Nifty niftyParam, final Screen screenParam) {
    this.nifty = niftyParam;
    this.screen = screenParam;

 
  }

  public final void onStartScreen() {
    if (nifty.findPopupByName("popupExit") == null)
        nifty.createPopupWithId("popupExit", "popupExit");
    
    nifty.showPopup(this.screen, "popupExit", null);
    NYC3D.showMenuTrigger = true;
  }

  public final void onEndScreen() {
      //nifty.closePopup("popupExit"); 
  }

  public void resume() {     
    if (NYC3D.state.equals(NYC3D.State.MENU))
       nifty.fromXml("menu.xml", "menu");
    else{
        if (NYC3D.hudActive){
            nifty.fromXml("hud.xml", "hud");
            NYC3D.hideMenuTrigger = true;
        }
        
    }
  }

  public void exit() {
    System.exit(0);
  }


}